/**
 * This file is released under the GNU General Public License.
 * Refer to the COPYING file distributed with this package.
 *
 * Copyright (c) 2008-2009 WURFL-Pro srl
 */
package net.sourceforge.wurfl.core.handlers.matchers;

import java.util.SortedSet;

import net.sourceforge.wurfl.core.handlers.Handler;
import net.sourceforge.wurfl.core.utils.StringUtils;

public class OperaMatcher extends AbstractMatcher {

	private static final int OPERA_TOLLERANCE = 5;

	public OperaMatcher(Handler handler) {
		super(handler);
	}

	/**
	 * Apply LD(5).
	 */
	protected String lookForMatchingUserAgent(SortedSet userAgentsSet,
			String userAgent) {
		
		if (logger.isDebugEnabled()) {
			logger.debug("Applying LD(" + OPERA_TOLLERANCE + ") UA: " + userAgent);
		}

		return StringUtils.ldMatch(userAgentsSet, userAgent, OPERA_TOLLERANCE);
	}
}
